<template>
  <div class="view-container" id="departmentList">
    <header class="view-header">
      <div class="header-container">
        <div class="header-title">
          <i class="el-icon-s-grid"></i>
          <span>全部共享</span>
        </div>
        <div class="header-form">
          <!--更多-->
<!--          <div class="header-form-item">
            <el-dropdown @command="handleCommand">
              <el-button type="default" :loading="delLoading">
                更多<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item icon="el-icon-refresh-right" class="color-refresh-item" command="refresh">刷新
                </el-dropdown-item>
                <el-dropdown-item icon="el-icon-edit" class="color-edit-item" command="edit">编辑</el-dropdown-item>
                <el-dropdown-item icon="el-icon-delete" class="color-del-item" command="del">{{isBatchesDel}}
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>-->
          <!--搜索-->
<!--          <div class="header-form-item">
            <el-button type="primary" icon="el-icon-search" @click="fetchData">查询</el-button>
          </div>-->
          <div class="header-form-item">
            <el-button type="danger" :loading="delLoading" icon="el-icon-delete" @click="del">{{isBatchesDel}}</el-button>
          </div>
          <div class="header-form-item">
            <el-button type="primary" icon="el-icon-edit" @click="edit">编辑</el-button>
          </div>
          <div class="header-form-item">
            <el-button type="success" icon="el-icon-plus" @click="toAddPage">添加</el-button>
          </div>
        </div>
      </div>
    </header>
<!--"infoId": "3838DD0B-A1EA-4C7A-B1BF-59920937CBA2",
      "infoTitle": "2020年报风控部内审资料一览表",
      "infoCode": "",
      "infoUse": "内部交流",
      "infoType": "下传",
      "infoContent": null,
      "shareType": "全部",
      "sharedZone": null,
      "allowTop": false,
      "allowComment": true,
      "creator": 511,
      "created": "2020-01-22",
      "creatorName": null,
      "readed": "0"-->
    <section>
      <el-table
        ref="table"
        :data="tableData"
        stripe
        border
        @selection-change="handleSelectionChange"
        @row-click="handleRowClick"
      >
        <el-table-column type="selection" align="center"/>
        <el-table-column label="标题" align="left">
          <template slot-scope="s">
            <el-link>{{s.row.infoTitle}}</el-link>
          </template>
        </el-table-column>
        <el-table-column width="150"  prop="infoUse" label="分享范围" align="center"/>
        <el-table-column width="100" prop="infoType" label="分类" align="center"/>
        <el-table-column width="100" prop="creator" label="发布人" align="center"/>
        <el-table-column width="150" sortable prop="created" :formatter="createdFmt" label="发布时间" align="center"/>
      </el-table>
    </section>


  </div>
</template>

<script>
  import workAPI from '@/api/workExchange/workExchange'
  import listMixin from '@/mixin/listMixin'
  export default {
    name: 'WorkExchangeAll',
    mixins:[listMixin],
    data() {
      return {
        mixinParams:{
          addUrl:'/work-exchange/save',
          editUrl:'',
          propertyName:'infoId',
          API:workAPI
        },
      }
    },
    methods: {
      fetchData() {
        workAPI.all(this.page).then(res => {
          this.tableData = res.records
          this.page.total = res.total
        })
      },
      createdFmt(row){
        return this._util.format(row.created)
      }
    }
  }
</script>

<style lang="scss">

  #departmentList {
    .el-dialog {
      width: 500px;
    }
  }

</style>

